<template>
  <view>
    <view class="container_box">
      <view class="container_box_Item" v-for="(item,i) in BankList" :key="i" @click="bankClick(item)">
        <image :src="item.previewImage" mode="aspectFill"></image>
        <view class="container_box_Item_text">
          <h1>{{item.bankType}}</h1>
          <text>{{item.bankNumber}}</text>
        </view>
      </view>
    </view>

    <view class="container_btn" @click="navTo('/subpkg/addcard/addcard')">
      <button type="default">添加银行卡</button>
    </view>
  </view>
</template>

<script>
  import {
    getBank
  } from "@/api/attestation.js"

  export default {
    data() {
      return {
        BankList: []
      };
    },
    onLoad() {
      this.getBankList()
    },
    onShow(){
      this.getBankList()
    },
    methods: {
      navTo(url) {
        uni.navigateTo({
          url: url
        })
      },
      getBankList() {
        getBank().then(res => {
          this.BankList = res.data
        })
      },
      bankClick(item) {
        // this.navTo('/subpkg/withdraw/withdraw?bankType=' + item.bankType)
        wx.setStorageSync('bank', item)
        uni.navigateBack()
      }
    }
  }
</script>

<style lang="scss">
  .container_box {
    padding: 0 30rpx;

    .container_box_Item {
      padding: 40rpx 0;
      border-bottom: 1rpx solid rgba(241, 241, 241, 1);
      display: flex;

      image {
        width: 86rpx;
        height: 86rpx;
        margin-right: 21rpx;
      }

      .container_box_Item_text {
        display: flex;
        flex-direction: column;
        justify-content: space-around;

        h1 {
          color: rgba(61, 61, 61, 1);
          font-size: 32rpx;
        }

        text {
          color: rgba(61, 61, 61, 0.6);
          font-size: 28rpx;
        }
      }
    }
  }

  .container_btn {
    width: 100%;
    position: fixed;
    bottom: 56rpx;
    padding: 0 30rpx;
    box-sizing: border-box;

    button {
      height: 97rpx;
      border-radius: 226rpx;
      font-size: 36rpx;
      background-color: rgba(253, 211, 56, 1);
      color: rgba(61, 61, 61, 1);
      line-height: 93rpx;
    }

  }
</style>
